import java.util.Scanner;
 public class A4{
	 public static void main(String[] agrs){
		 //回文数
		 Scanner sc = new Scanner(System.in);
		 System.out.println("请输入一个整数");
		 int number = sc.nextInt();
		 int temp = number;
		 int one = 0;
		 while(number != 0){
			 int ge = number % 10;
			 one = one * 10 + ge;
			 number = number / 10;
		 }
		 System.out.println(one);
		 if(one == temp)
			 System.out.println(temp+"是回文数");
		 else
			 System.out.println(temp+"不是回文数");
		 
		 //将两个数相除,得到商和余数,要求不使用乘法,除法和%运算符
		 System.out.println("请输入被除数");
		 int devident = sc.nextInt();
		 System.out.println("请输入除数");
		 int deviser = sc.nextInt();
		 int quotient = 0;
		 while(devident >= deviser){
			 devident = devident - deviser;
			 quotient++;
		 }
		 int remainder = devident;
		 System.out.println("商是"+quotient+",余数是"+remainder);
		 
		 //输入一个整数,计算并返回这个数的算术平方根,结果只保留整数部分
		 System.out.println("请输入一个整数");
		 int number1 = sc.nextInt();
		 int square_root = 0;
		 int result = 0;
		 while(result <= number1){
			 square_root++;
			 result = square_root * square_root;
		 }
		 System.out.println(number1+"的算术平方根是"+(square_root-1));
		 
		 //输入一个数判断是否为质数
		 System.out.println("请输入一个整数");
		 int number2 = sc.nextInt();
		 int i = 2;
		 for(i = 2;i < number2;i++){
			 if(number2 % i == 0)
			 break;
		 }
		 if(i == number2)
			 System.out.println(number2+"是质数");
		 else
			 System.out.println(number2+"不是质数");
		 //判断质数方法2
		 System.out.println("请输入一个整数");
		 int number3 = sc.nextInt();
		 boolean flag = true;
		 int m = 2;
		 for(m = 2;m < number3;m++){
			 if(number3 % m == 0){
				 flag = false;
				 break;
			 }
		 }
		 if(flag)
			 System.out.println(number3+"是一个质数");
		 else
			 System.out.println(number3+"不是一个质数");
			 
			 
	 }
 }